// 发送ajax请求
import config from "./config";


export default (url, data = {}, method = 'GET') => {
    return new Promise((resolve, reject)=>{
        wx.showLoading({
            title: '加载中...',
          }) 
        wx.request({
            url: config.baseURL + url,
            data,
            method,
            success: (res) => { 
                resolve(res.data) 
            },
            fail: (err) => {
                reject(err)
            },
            complete: (res) => {
                wx.hideLoading();
            },
        });
    })
}
